Skip to content

fix(autoware_gnss_poser): skip a fix without its antenna transform and report it once - #1523

Merged
kentdotn merged 5 commits into
autowarefoundation:mainfrom
kentdotn:feat/gnss-poser-report-missing-antenna-transform
Nov 30, 2026
Merged

kentdotn merged 5 commits into
autowarefoundation:mainfrom
kentdotn:feat/gnss-poser-report-missing-antenna-transform

Conversation

@kentdotn

@kentdotn kentdotn commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

Purpose

When TF cannot provide the transform from the antenna frame of a fix to base_frame, autoware_gnss_poser composes the base_link pose with the identity transform: it publishes the antenna position as the vehicle pose, with the receiver's covariance, as if nothing were missing. That pose is wrong by the lever arm, whether the transform is merely late or never comes. Meanwhile the lookup logs two throttled warnings for every such fix, which also appear on a correctly configured vehicle, since depending on the startup order the first fixes can arrive before /tf_static.

This PR stops publishing the wrong pose, and then makes the missing transform visible once rather than every second:

  1. A fix without its antenna transform is skipped.
  2. Since a missing transform now means no pose, it is logged once, after a grace period from the first fix.
  3. A lookup that waiting will not fix is logged at once.

Skipping comes first because it is what makes the report necessary: without the report, the pose would stop silently.

This PR builds on #1537 (merged), which looks the transform up as the latest. With that, a lookup fails only when the transform has not been received, not because of the fix's stamp, so skipping does not cost a setup that publishes the relation on /tf any fixes.

Skipping the fix

The antenna -> base_link transform is taken to be static (an antenna that moves relative to base_link is out of scope; #1537 looks it up as the latest), and a fix without it is skipped. No buffering of fixes and no timeout is needed under that assumption.

  • A fix whose transform cannot be looked up yields the new Outcome::TransformLookupFailed: gnss_fixed with the receiver's status (which does not depend on TF) and no pose. Skipped fixes are not replayed.
  • The lookup stays at the end of the pipeline, so a skipped fix has still been observed: it is in the position buffer and it advances the motion heading.

This follows what autoware_ndt_scan_matcher does for the sensor frame of its point cloud: drop the measurement on failure.

Reporting the missing transform

The rule:

  • Grace period from the first fix. Right after startup /tf_static may not have arrived yet, so a missing transform is not reported within 5 s (antenna_transform_grace_period) of the first fix, whatever its status.

  • Once. After that, the first fix that cannot get the transform reports it. It is reported again only after a fix has got the transform in between. The log stays, so repeating it adds nothing.

  • Measured by the fix header stamps. The grace period follows the data rather than a clock: a rosbag replayed at another rate, or a simulator slower than real time, gives the same result as the vehicle. input_fix(fix) keeps its signature and the unit tests need no clock.

  • A failed lookup at once. The lookup now says why it could not provide the transform, as GnssPoser::TransformLookupError:

    • Unavailable: TF is not ready for the lookup yet; it has not received the frames, or not the transforms that connect them (tf2::LookupException, tf2::ConnectivityException). Expected right after startup, so it keeps the grace period.
    • Failed: TF was ready, but the lookup failed (any other tf2::TransformException, e.g. a frame name TF does not accept). Waiting does not help, so it is reported at once.

    Each error is reported once until a fix gets the transform, independently of the other: Failed is the rarer one and says something Unavailable does not, so a reported Unavailable must not hide it. For the fix either error means the same, Outcome::TransformLookupFailed.

GnssPoser decides when to report, because it is GnssPoser that decides to skip the fix: whether a skipped fix is expected is part of the same behavior, and it is unit-tested with stamped fixes alone. The decision is carried in the result of the fix, as Result::antenna_transform_error, set at the one fix where it is to be logged. The node only logs it, as an error naming both frames, with "Fixes are skipped.". The state behind it is the stamp of the first fix and, per error, whether it has been reported since the transform was last obtained.

Commits

Each commit builds and passes every test on its own.

# Commit Kind What to look for
1 leave out the empty fields of a result refactor The optional fields of Result default to std::nullopt, so the existing returns without a pose name only the outcome and gnss_fixed. No behavior change; the following commits build their results the same way.
2 skip a fix without its antenna transform fix A fix without the transform yields Outcome::TransformLookupFailed and no pose instead of the identity fallback. The lookup keeps its throttled warnings, so the logs are as before. All the node test changes are here.
3 log a missing antenna transform once, after a grace period fix The reporting rule: Result::antenna_transform_missing at the first fix without the transform more than 5 s after the first fix, again only after the transform was obtained. The rule is one predicate, should_report_transform_missing(), over two members of state; the node logs it, and the lookup no longer logs.
4 report a failed antenna transform lookup at once feat TransformLookup returns tl::expected<Transform, TransformLookupError>, the node maps the tf2 exceptions to Unavailable or Failed, and Result::antenna_transform_missing becomes Result::antenna_transform_error, which says which one to log. The predicate becomes should_report_transform_error(), in which Failed skips the grace period, and the state becomes one flag per error, so that each is reported once.
5 check the first fix stamp before reading it refactor should_report_transform_error() checks that the first fix stamp is set before reading it. input_fix() always sets it before the lookup, but clang-tidy (bugprone-unchecked-optional-access) cannot see that across the two functions. No behavior change.

Tests

The fixes of the node test keep their default frame, gnss, for which the fixture publishes no transform. A fix that reaches the lookup in that frame used to get the identity fallback and is now dropped, so the two cases that publish a pose from such a fix, Gate_FirstFixAfterMgrsProjector_PublishesOneOfEachOutput and MethodBuffered_PubMethodParameter_SelectsTheMethod, now publish the identity as the static TF gnss -> base_link first. With it they publish the same poses as before, so what they check is unchanged. It is published only in these two cases rather than by the fixture for every case, since each publication waits for the TF to propagate and the other cases do not need it. No other case gets an unintended lookup failure: the other cases either send no fix, send fixes that stop before the lookup, or name their frame (my_antenna with its TF, my_base equal to base_frame, or a frame without a TF on purpose to check the drop).

Before After
— Tf_MissingTransform_PublishesOnlyGnssFixed (unit; a TEST_P over both lookup errors from commit 4): the fix is dropped, gnss_fixed is still reported, and the outcome is TransformLookupFailed
— Tf_MissingTransform_FixStaysInPositionBuffer (unit): the dropped fix still counts for the average once the transform appears
— Tf_MissingTransform_FixAdvancesMotionHeading (unit): the first published heading is the step from the last dropped fix
Tf_AntennaFrameComesFromFixHeader_UnknownFrameFallsBackToIdentity (integration, with a NOTE(characterization)) ..._UnknownFrameDropsTheFix; the note is gone, the defect it described is fixed
— Tf_UnavailableWithinGracePeriod_NotReported (unit, commit 3): fixes at 0 s and at exactly the grace period without the transform report nothing
— Tf_UnavailableBeyondGracePeriod_ReportedOnce (unit, commit 3): the first fix past the grace period reports it, the next one does not
— Tf_UnavailableAfterGracePeriod_ReportedAtOnce (unit, commit 3): the grace period is measured from the first fix of all, so a transform missing only after it is reported at the first such fix
— Tf_UnavailableAgainAfterAvailable_ReportedAgain (unit, commit 3): a fix that gets the transform ends the outage, so the next missing transform is reported again
— Tf_LookupFailed_ReportedAtOnce (unit, commit 4): a failed lookup is reported at the first fix, without the grace period

The node test does not check logs.

How was this PR tested?

  • colcon test: 42 unit + 32 node instances pass, plus the ament linters (33 + 32 after commit 1, 36 + 32 after commit 2, 40 + 32 after commit 3; commit 5 adds no test).
  • clang-format 21.1.8 and cpplint 2.0.2 pass, and clang-tidy 18.1.8 reports nothing for gnss_poser.cpp and gnss_poser_node.cpp.

Notes for reviewers

  • The grace period is 5 s, a constant next to GnssPoser. Whether it should be longer, or a parameter, is open.
  • The first fix is taken once. A rosbag replayed in a loop therefore gets the grace period only on its first pass, and a transform still missing in a later pass is not reported again. TF keeps /tf_static across a backward time jump anyway, so a later pass cannot reproduce a late /tf_static in the first place.
  • An antenna frame that changes while the transform is missing is not reported on its own; one report covers the outage.
  • The log no longer carries the tf2 exception text, only the two frame names; GnssPoser stays free of tf2 wording.
  • libexpected-dev (for tl::expected) is a new dependency of the package (already used by autoware_trajectory, autoware_path_generator and autoware_downsample_filters).
  • The mapping from tf2 exceptions to the two errors is not tested; it follows BufferCore::lookupTransform (tf2 0.36 / Humble / Rolling).

Interface changes

No parameter, topic or QoS change. Observable behavior changes:

  • A fix whose antenna transform is missing produces no gnss_pose, gnss_pose_cov or map -> gnss_base_link TF (it produced a pose equal to the antenna position before). gnss_fixed is unchanged.
  • A missing transform is logged once as an error, after 5 s from the first fix if TF is not ready and at once if the lookup fails, instead of two warnings per fix.

Effects on system behavior

A vehicle whose TF is configured correctly sees no change, except that fixes arriving before /tf_static (depending on the startup order) are skipped silently instead of being published at the antenna position with warnings. A vehicle whose header.frame_id does not match the URDF stops producing gnss_pose instead of producing one that is wrong by the lever arm, and logs one error saying so.

🤖 Generated with Claude Code

@kentdotn kentdotn added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.59574% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.34%. Comparing base (ebb14ad) to head (8c8f510).

Files with missing lines Patch % Lines
...ensing/autoware_gnss_poser/src/gnss_poser_node.cpp 26.66% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1523      +/-   ##
==========================================
- Coverage   82.36%   82.34%   -0.02%     
==========================================
  Files         421      421              
  Lines       23857    23897      +40     
  Branches      147      147              
==========================================
+ Hits        19650    19679      +29     
- Misses       4177     4188      +11     
  Partials       30       30              
Flag Coverage Δ *Carryforward flag
daily ?
full-suite 82.36% <ø> (-0.01%) ⬇️ Carriedforward from ebb14ad

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kentdotn
kentdotn force-pushed the feat/gnss-poser-report-missing-antenna-transform branch from f42fb12 to d41c2f7 Compare November 5, 2026 11:25

@sasakisasaki sasakisasaki left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Now reviewed. I believe it is good idea to let the user know the issue when the expected topic does not come for 5 seconds.

Also, log output looks controlled not to shot very frequently.

I agree with merging this PR 👍

@kentdotn
kentdotn force-pushed the feat/gnss-poser-report-missing-antenna-transform branch 2 times, most recently from 003f0ec to 047b131 Compare November 9, 2026 07:53
@kentdotn
kentdotn force-pushed the feat/gnss-poser-report-missing-antenna-transform branch from 047b131 to 5087ba1 Compare November 16, 2026 05:22
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

This pull request comes from a fork, so its documentation site is built but not published.

  • Download the site of commit 8c8f510: docs-pr-1523. You must be signed in to GitHub. The site is kept for 90 days.
  • Follow the steps in the run summary to view it on your computer.

@kentdotn kentdotn changed the title feat(autoware_gnss_poser): report a missing antenna transform once fix(autoware_gnss_poser): skip a fix without its antenna transform and report it once Nov 16, 2026
@kentdotn
kentdotn force-pushed the feat/gnss-poser-report-missing-antenna-transform branch from 5087ba1 to 5052773 Compare November 16, 2026 11:23

@sasakisasaki sasakisasaki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for refactoring! Now reviewed again! I agree with merging this PR while put a very minor comment 👍

// zero translation and rotation w = 1).
const geometry_msgs::msg::Transform antenna_to_base_link =
lookup_antenna_to_base_link_(fix.header.frame_id).value_or(geometry_msgs::msg::Transform{});
// get TF from gnss_antenna to base_link. Without it the fix cannot be expressed as a base_link

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to explicitly say at the very beginning of the comment like "Do not input this fix if its transform is not available".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I've separated the comment in two parts; the second one starts with an explicit explanation of the behavior.

@kentdotn
kentdotn force-pushed the feat/gnss-poser-report-missing-antenna-transform branch from 5052773 to cb14f60 Compare November 17, 2026 05:08
@kentdotn
kentdotn marked this pull request as ready for review November 17, 2026 10:03
kentdotn and others added 5 commits November 30, 2026 15:27
Every outcome but Published returns a Result whose pose fields are all
empty, spelled out as a row of std::nullopt at each return. The optional
fields of Result now default to std::nullopt, so a return names only
what it carries. No behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kentaro NAGATOMO <kentaro.nagatomo@tier4.jp>
When TF could not provide the transform from the antenna frame of a fix
to base_link, the node composed the base_link pose with the identity
transform, that is, it published the antenna position as the vehicle
pose with the receiver's covariance. The pose is wrong by the lever arm
whether the transform is merely late or never comes.

Skip such a fix instead: no gnss_pose, gnss_pose_cov or map -> gnss_base
TF, while gnss_fixed keeps reporting the receiver's status, which does
not depend on TF. GnssPoser returns the new Outcome::TransformLookupFailed
for it, which logs nothing more: the lookup keeps its throttled warning,
which the next commit replaces. The lookup stays at the end of the
pipeline, so a skipped fix has still been observed: it is in the
position buffer and it is the previous position of the motion
orientation. Skipped fixes are not replayed.

Since the transform is looked up as the latest, a lookup fails only
when the transform has not been received, not because of the fix's
stamp, so skipping does not cost a setup that publishes the relation on
/tf any fixes. This follows what autoware_ndt_scan_matcher does for the
sensor frame of its point cloud: drop the measurement on failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kentaro NAGATOMO <kentaro.nagatomo@tier4.jp>
… a grace period

Since the fix without its antenna transform is skipped, a missing
transform means no pose, so it has to be visible. The lookup warned
every second instead, from the first fix on, although right after
startup /tf_static may simply not have arrived yet; the warnings went
on for as long as the transform was missing.

GnssPoser now decides when it is to be logged, as it decides to skip the
fix: Result::antenna_transform_missing is set at the first fix that
cannot get the transform more than antenna_transform_grace_period (5 s)
after the first fix, of any status, and again only after a fix has got
the transform. The time is measured by the fix header stamps, so that it
follows the data, e.g. a rosbag replayed at another rate. The first fix
is taken once, so a rosbag replayed in a loop gets the grace period only
on its first pass; TF keeps /tf_static across the loop anyway. The node
logs an error naming both frames when the flag is set, and the lookup
no longer logs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kentaro NAGATOMO <kentaro.nagatomo@tier4.jp>
…t once

A transform that TF has not received yet is expected right after
startup, and waiting resolves it; a lookup that TF rejects although it
is ready, for example for a frame name it does not accept, does not
resolve by waiting. Giving both the same grace period delays the
report of the latter for nothing.

The lookup now reports why it could not provide the transform, as
GnssPoser::TransformLookupError: Unavailable when TF is not ready for it
yet (a frame, or a transform connecting the frames, has not been
received: tf2::LookupException, tf2::ConnectivityException), Failed for
any other tf2::TransformException. The node only converts the tf2
exceptions. Result::antenna_transform_missing becomes
Result::antenna_transform_error, which says which one to log:
Unavailable keeps the grace period, Failed is set at once. Each error is
reported once until a fix gets the transform, independently of the
other: Failed is the rarer one and says something Unavailable does not,
so a reported Unavailable must not hide it. For the fix either error
means the same, so both give Outcome::TransformLookupFailed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kentaro NAGATOMO <kentaro.nagatomo@tier4.jp>
…ng it

should_report_transform_error() read first_fix_stamp_ with value()
without checking it. input_fix() sets the stamp before any lookup, so it
is always there, but clang-tidy cannot see that across the two
functions and reported bugprone-unchecked-optional-access. Check
has_value() first. Without a first fix stamp the grace period does not
apply, so the error would be reported; this does not happen in practice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Kentaro NAGATOMO <kentaro.nagatomo@tier4.jp>
@kentdotn
kentdotn force-pushed the feat/gnss-poser-report-missing-antenna-transform branch from cb14f60 to 8c8f510 Compare November 30, 2026 06:30
@kentdotn
kentdotn merged commit 29db97d into autowarefoundation:main Nov 30, 2026
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants